#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;

int main()
{
    int  n = 0;
    int count = 0, max_count = 0;
    cin >> n;
    for (int i = 0; i < 32; i++) {
        if (n & (1 << i)) {
            count++;
        }
        else {
            max_count = max(count, max_count);
            count = 0;
        }
    }
    max_count = max(count, max_count);
    cout << max_count << endl;
    return 0;
}